# -*- coding: utf-8 -*-

import numpy as np;
import matplotlib.pyplot as mp;

from eod import *


###############
# Structure de données pour les fonctions :
# 0 : Dimension
# 1 : t0
# 2 : y(t0)
# 3 : F(y,t)
###############

fun1 = (1, 0, 1, lambda y, t: y/(1+t**2));
fun2 = (2, 0, np.array([0.,1.]), lambda y,t: np.array([-y[1], y[0]]));

X = np.arange(0, 2, 0.1);
y1 = np.exp(X);

y2 = np.zeros(len(X));
y3 = np.zeros([len(X),fun2[0]]);

i=0;
for x in X:
	y2[i]=meth_epsilon(fun1[2], fun1[1], x,  0.01, fun1[3], step_euler);
	y3[i]=meth_n_step(fun2[2], fun2[1], x,  0.01, fun2[3], step_euler);
	i+=1;
	
mp.clf();
mp.plot(X, y2, color='blue');
mp.plot(X, y3[:,0], color='red');
mp.plot(X, y3[:,1], color='green');
mp.show();

